<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link crossorigin="anonymous" href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
    <h2 class="page-header">jQuery发送AJAX请求 </h2>
    <button class="btn btn-primary">PUT</button>
    <button class="btn btn-danger">DELETE</button>
    <button class="btn btn-info">通用型方法ajax</button>
</div>
<script crossorigin="anonymous" src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
    $('button').eq(0).click(function () {
        // alert("点击了");
        $.ajax({
            type: "put",
            url: "http://localhost:8080/put1",
            success: function (data) {
                console.log(data);
            }
        });
    })
    $('button').eq(1).click(function () {
        $.ajax({
            type: 'delete',
            url: 'http://localhost:8080/delete1',
            timeout: 2000,
            success: function (res) {
                console.log(res);
            }
        })
    })
</script>
</body>
</html>